histGraph <-
function(x,breaks="Sturges",rel=FALSE,cum=FALSE,poly=FALSE,...){
	h<-hist(x,breaks,plot=FALSE)
	if(cum){
		if(rel){
			h$counts <- cumsum(h$counts)/sum(h$counts) 
			plot(h,ylab="Frecuencia relativa acumulada",...)
		}
		else{
			h$counts <- cumsum(h$counts) 
			plot(h,ylab="Frecuencia absoluta acumulada",...)
		}
		if(poly){
			xx<-h$breaks
			yy<-c(0,h$counts)
			lines(xx,yy)
		}
	}
	else{
		if(rel){
			h$counts <- h$counts/sum(h$counts) 
			plot(h,ylab="Frecuencia relativa",...)
		}
		else
			plot(h,ylab="Frecuencia absoluta",...)
	    if(poly){
			xx<-h$mids
			zz<-h$breaks
			x1<-xx[1]-zz[2]+zz[1]
			z<-length(zz)
			x2<-xx[z-1]+zz[z]-zz[z-1]
			xx<-c(x1,xx,x2)
			yy<-c(0,h$counts,0)
			lines(xx,yy)
		}
	}
}

